#include<cstdio>
int n;
int x[200005];
int k[200005];
int main(){
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout); 
	scanf("%d",&n);
	for(int i=0;i<n;++i)
		scanf("%d",x+i);
	k[n-1]=1;
	for(int i=n-2;i>=0;--i){
		if(x[i]!=x[i+1])
			k[i]=1;
		else
			k[i]=k[i+1]+1;
	}
	int num=n;
	while(num){
		int lst=-1,f=0;
		for(int i=0;i<n;){
			if(x[i]==-1){
				++i;
				continue;
			}
			if(x[i]==lst){
				++i;
				continue;
			}
			lst=x[i];
			x[i]=-1;
			printf("%d ",i+1);
			i+=k[i];
			num--;
		}
		puts("");
	}
	return 0;
}
